﻿#include "card.h"

Card::Card()
{

}

Card::Card(Card::CardPoint point, Card::CardSuit suit)
{
    setPoint(point);
    setSuit(suit);
}

void Card::setPoint(Card::CardPoint point)
{
    m_point=point;
}

void Card::setSuit(Card::CardSuit suit)
{
    m_suit=suit;
}

Card::CardPoint Card::point() const
{
    return m_point;
}

Card::CardSuit Card::suit() const
{
    return m_suit;
}

bool lessSort(Card &card1, Card &card2)
{
    if(card1.point()==card2.point())
    {
        return card1.suit()<card2.suit();
    }
    if(card1.point()<card2.point())
    {
        return true;
    }
    else{
        return false;
    }
}

bool greaterSort(Card &card1, Card &card2)
{
    if(card1.point()==card2.point())
    {
        return card1.suit()<card2.suit();
    }
    if(card1.point()<card2.point())
    {
        return false;
    }
    else{
        return true;
    }
}

bool operator==(const Card &left, const Card &right)
{
    return (left.point()==right.point()&&left.suit()==right.suit());
}

int qHash(const Card &card)
{
    return card.point()*100+card.suit();
}


bool operator<(const Card &card1, const Card &card2)
{
    if(card1.point()!=card2.point())
    {
     return card1.point()<card2.point();
    }
    else
    {
        return card1.suit()<card2.suit();
    }
}
